<template>
  <li class="cjy-page-body-commodity-li">
    <div>
      <div class="cjy-page-bod-commodity-box">
        <div class="cjy-page-image-box" @click="gotoDetail">
          <img v-lazy="comInfor.mainPic" :key="comInfor.mainPic" style="width: 100%" class="cjy-page-image-box-img">
        </div>
        <div class="cjy-page-title-box">
          <span style="">{{goodsName || '\r'}}</span>
        </div>

        <!--<div class="cjy-page-subtitle-box">
          <span style="">{{subTitle || '\r'}}</span>
        </div>-->
        <div class="cjy-page-lable-box">
           <span class="cjy-lable" v-if="regularTypeLabel"> {{regularTypeLabel}}</span>
          <span v-else>{{'\r'}}</span>         
        </div>
        <div style="text-align: left;margin-left: 0.3rem;font-size: 0.5rem;color:#6b6b6b"><del class="normal-price" v-if="showNormalPrice != showWsPrice">¥{{parseFloat(showNormalPrice).toFixed(2)}}</del></div>        
        <div class="cjy-page-price-box">
          ¥<span class="cjy-price">{{showWsPrice}}</span>
        </div>
        <update-cart ref="updateCart"
                     :addCartButtonType="0"
                     :commodityInfor="comInfor"
                     :goodsId="goodsId"
                     @click="cartButtonOnClick">
          <div class="cjy-add-cart-button-box"
               slot="button" slot-scope="props"
               @click="cartButtonOnClick">
            <button-change-cart :type="buttonType" fontSize="1.2rem" :style="buttonStyle" @click="cartButtonOnClick">
            </button-change-cart>
          </div>
        </update-cart>

      </div>
    </div>
  </li>
</template>

<script>
  import UpdateCart from '@/real-components/UpdateCart'
  import lazyLoad from 'vue-lazyload'
  import ButtonChangeCart from '@/real-components/ButtonChangeCart/icon'
  import minxinAuto from '../mixinAuto.vue'
  export default {
    data(){
      return {
        buttonType: 2
      }
    },
    mixins: [minxinAuto],
    components: {UpdateCart, ButtonChangeCart},
  }
</script>

<style scoped>
  .cjy-page-body-commodity-li {
    position: relative;
    float: left;
    width: 33.3%;
    height: 0;
    padding-bottom: 58%;
    margin-bottom: 0.5rem;
  }

  .cjy-page-body-commodity-li > div {
    position: absolute;
    width: 100%;
    height: 100%;
    padding: 0 0.1rem;
  }

  .cjy-page-bod-commodity-box {
    width: 100%;
    height: 100%;
    background: white;
    position: relative;
    overflow: hidden;
    border-radius: 4px;
  }

  .cjy-page-image-box {
    width: 100%;
    height: 0;
    position: relative;
    padding-bottom: 100%;
    overflow: hidden;
    border-top-left-radius: 4px;
    border-top-right-radius: 4px;
  }
  .cjy-page-image-box-img{
  	border-top-left-radius: 4px;
    border-top-right-radius: 4px;
  }

  .cjy-page-title-box, .cjy-page-lable-box, .cjy-page-price-box, .cjy-page-subtitle-box {
    padding: 0 0.3rem;
    text-align: left;
    text-overflow: ellipsis;
    overflow: hidden;
    word-break: break-all;
    white-space: nowrap;
  }

  .cjy-page-title-box {
    color: #444;
    line-height: 0.8rem;
    height: 1.6rem;
    font-weight: 600;
    font-size: 0.65rem;
    word-break: break-all;
    white-space: pre-wrap;
  }

  .cjy-page-subtitle-box {
    color: #444;
    line-height: 0.8rem;
   /* font-weight: 600;*/
    font-size: 0.65rem
  }

  .cjy-page-lable-box {
    font-size: 0.6rem;
    width: 100%;
    color: #FB4F5C;
    text-line-height: 0.9rem;
    display: inline-block;
  }

  .cjy-page-lable-box > .cjy-lable {
    display: inline-block;
    border-radius: 0.3rem;
    border: 1px solid #FB4F5C;
    font-size: 0.4rem;
    color: #FB4F5C;
    padding: 0px 0.2rem;
  }

  .cjy-page-price-box {
    position: absolute;
    bottom: 0;
    width: 100%;
    font-size: 0.65rem;
   /* margin-bottom: 0.1rem;*/
    color: rgb(246, 86, 86);
  }

  .cjy-page-price-box > .cjy-price {
    font-size: 0.8rem;
    font-weight: 400;
    display: inline-block;
    line-height: 0.8rem;
  }

  .cjy-page-price-box > .cjy-price-unit {
    color: black;
  }

  .cjy-add-cart-button-box {
    height: 1.2rem;
    width: 1.2rem;
    position: absolute;
    z-index: 1;
    right: 0;
    bottom: 5px;
  }
</style>
